<template>
  <div class="EbImagePreview">
    <div v-for="item in fileList">
      <el-image
          :src="item.url"
          :preview-src-list="[item.url]"
      ></el-image>
    </div>
  </div>
</template>
<script setup name="EbImagePreview">
import {getAttachments} from "@/api/easybook/attachments.js";
import request from "@/utils/request.js";
const props = defineProps({
  ids: {
    type: [
      Array],
    default: () => []
  }
})

const fileList = ref([])

watch(
    () => props.ids,
    (newValue, oldValue) => {
      if (newValue && Array.isArray(newValue) && newValue.length > 0) {
        request({
          url: "/easybook/attachments/listByIds",
          method: "post",
          data: newValue,
        })
            .then((res) => {
              fileList.value = res.rows
            })
      }
      else{
        fileList.value = []
      }

    },
    {
      deep: true,
      immediate: true
    }
)
onMounted(() => {
})
</script>
<style scoped lang="scss">
.EbImagePreview {
}
</style>
